from solution import Solution


def is_palindrome(s):
    return s == s[::-1]


def test():
    sol = Solution()
    test_cases = [
        (
            "google",
            [
                ["g", "o", "o", "g", "l", "e"],
                ["g", "oo", "g", "l", "e"],
                ["goog", "l", "e"],
            ],
        ),
        ("aab", [["a", "a", "b"], ["aa", "b"]]),
        ("a", [["a"]]),
    ]

    for i, (s, expected) in enumerate(test_cases):
        result = sol.partition(s)
        # Verify all partitions are palindromes
        for partition in result:
            for substr in partition:
                assert is_palindrome(
                    substr
                ), f"Case {i} failed: {substr} is not palindrome"
        print(f"Case {i} passed")
    print("All tests passed!")


if __name__ == "__main__":
    test()
